CDS 6334 - Visual Image Processing

Lecture 5: Binary Image Processing

1. What are Binary Images?

A binary image contains only two pixel values: foreground and background.
Binary images highlight regions of interest (ROI) while ignoring unnecessary details.
🧠 Remember:

Binary = Only 0 and 1

2. Binary Image Processing Tasks

  1. Thresholding
  2. Morphological Operations
  3. Connected Components
  4. Region Description
Processing Pipeline:
Threshold → Clean → Label → Describe

3. Thresholding

Thresholding converts a grayscale image into a binary image.
Pixels above a threshold become foreground while the rest become background.
🧠 Think:
Grayscale → Binary

4. Uses of Thresholding

Application Foreground Pixels
Edge Detection Strong gradients
Background Subtraction Moving objects
Intensity Detection Specific brightness levels
Colour Detection Specific colour ranges

5. Histograms and Thresholding

Histograms help determine suitable threshold values.
Thresholding works best when object and background form distinct histogram peaks.
🧠 Easy Case:
Two separate peaks = Easy threshold selection

6. Thresholding Challenges

Overlapping intensity distributions make threshold selection difficult.
Noise often creates incorrect foreground pixels.

7. Morphological Operations

Morphological operations modify the shape of foreground regions using a structuring element.
Commonly used to clean noisy binary images.
Main Operators:
Dilation and Erosion

8. Structuring Elements

A structuring element is a small mask used to scan the binary image.
Shape and size of the structuring element affect the result.

9. Dilation

Dilation expands foreground regions.
🧠 Dilation = Grow

10. Properties of Dilation

If a foreground pixel exists, neighbouring pixels may become foreground.
Result:
More 1's and thicker white regions.

11. Erosion

Erosion shrinks foreground regions.
🧠 Erosion = Shrink

12. Properties of Erosion

A pixel remains foreground only if all required neighbours are foreground.
Result:
More 0's and thinner white regions.

13. Opening

Opening performs erosion followed by dilation.
Removes small objects while preserving overall object shape.
🧠 Opening:
Erode → Dilate

14. Closing

Closing performs dilation followed by erosion.
Fills holes and gaps while preserving overall object shape.
🧠 Closing:
Dilate → Erode

15. Morphology on Grayscale Images

Operation Rule
Dilation Neighbourhood Maximum
Erosion Neighbourhood Minimum

16. Connected Components

Connected component analysis identifies separate connected foreground regions.
Each region receives a unique label.
Purpose:
Count and isolate objects.

17. Connectedness

Type Neighbours
4-Connected Up, Down, Left, Right
8-Connected Includes Diagonals
🧠 8-connected = More connections

18. Connected Component Labelling

  1. Find an unlabelled foreground pixel.
  2. Assign a new label.
  3. Find connected neighbours.
  4. Repeat recursively.
  5. Continue until all pixels are labelled.

19. Region Properties

Features extracted from labelled blobs.

20. Circularity

Measures how close a region is to a perfect circle.
Formula:
C = (4π × Area) / Perimeter²
Circularity ranges from 0 to 1.
🧠 Closer to 1 = More Circular

21. Applications

22. Advantages and Limitations

Advantages Limitations
Fast processing Noise sensitive
Easy storage Difficult clean segmentation
Simple algorithms Loss of information

23. Final Exam Summary

Most Important Points

  • Binary Image: Contains only foreground and background.
  • Thresholding: Converts grayscale to binary.
  • Histogram: Helps choose thresholds.
  • Dilation: Expands objects.
  • Erosion: Shrinks objects.
  • Opening: Erosion then dilation.
  • Closing: Dilation then erosion.
  • Structuring Element: Mask used in morphology.
  • Connected Components: Labels separate blobs.
  • 4-connected: No diagonals.
  • 8-connected: Includes diagonals.
  • Area: Number of pixels.
  • Centroid: Average position.
  • Bounding Box: Object boundary.
  • Circularity: Measures roundness.
  • Circularity Formula: (4Ï€ × Area) / Perimeter².